<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>代理商</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="/zhenze/Public/home/css/reset.css"/>
		 <script type="text/javascript" src="/zhenze/Public/home/js/jquery-3.1.1.min.js"></script>
		<link rel="stylesheet" href="/zhenze/Public/home/css/dailishouye.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/font-awesome.min.css" />
		<script type="text/javascript">
		function dianji(id){
			if(id==2){
				location.href="<?php echo U('agent/dailishouye',array('status'=>2));?>";	
			}
			if(id==3){
				location.href="<?php echo U('agent/dailishouye',array('status'=>3));?>";	
			}
			if(id==4){
				location.href="<?php echo U('agent/dailishouye',array('status'=>4));?>";	
			}
			if(id==5){
				location.href="<?php echo U('agent/dailishouye',array('status'=>5));?>";	
			}				  
		}
		</script>
	</head>
	
	<body>
		<div class="top">
			<i class="fa fa-angle-left"></i>
			<p><?php echo ($agentinfo["realname"]); ?></p>
		</div>
		<div class="cont">
			<img src="/zhenze/Public/home/img/admin_avatar.png" />
			<p><?php echo ($agentinfo["username"]); ?></p>
			<p class="p1"><?php echo ($agentinfo["money"]); ?></p>
			<a href="<?php echo U('agent/tixianshenqing');?>">提现</a>
			<p class="p2">本月业绩<span><?php echo ($opencount); ?></span></p>
			<p class="p3">本月任务<span><?php echo ($agentduty["duty_num"]); ?></span></p>
		</div>
		<div class="cont1">
			<ul>
				<li <?php if($status == 2): ?>class="color"<?php endif; ?> onclick="dianji(2)">待处理</li>
				<li <?php if($status == 3): ?>class="color"<?php endif; ?> onclick="dianji(3)">预约成功</li>
				<li <?php if($status == 4): ?>class="color"<?php endif; ?>  onclick="dianji(4)">预约失败</li>
				<li <?php if($status == 5): ?>class="color"<?php endif; ?> onclick="dianji(5)">开卡成功</li>
			</ul>
		</div>
		<div class="list">
			<ul id="jubu">
				<?php if(is_array($agentreserve)): $i = 0; $__LIST__ = $agentreserve;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><a href="<?php echo U('agent/dailixiangqing',array('reserve_id'=>$data['id']));?>">
					
					<li>
						<p><?php echo (date("Y-m-d",$data["time"])); ?><span><?php echo (date("h:i:s",$data["time"])); ?></span></p>
						<p class="p01"><?php echo ($data["uname"]); ?></p><p class="p02"><?php echo ($data["set_title"]); ?></p><p class="p03"><?php echo ($data["name"]); ?></p><p class="p04">
						<?php if($status == 2): ?>待处理<?php endif; ?>
						<?php if($status == 3): ?>预约成功<?php endif; ?>
						<?php if($status == 4): ?>预约失败<?php endif; ?>
						<?php if($status == 5): ?>开卡成功<?php endif; ?>	
						</p>
					</li>
				
					</a><?php endforeach; endif; else: echo "" ;endif; ?>
			</ul>
		</div>
		<button onclick="getmore()" id="morebtn" data='1' class="btn00">更多</button>

		<script type="text/javascript" src="/zhenze/Public/home/js/jquery-3.1.1.min.js" ></script>
		<script src="/zhenze/Public/home/js/screenSize.js" type="text/javascript" charset="utf-8"></script>
		<script>
		function getmore(){
			var page=parseInt($('#morebtn').attr("data"))+1;
			$.getJSON("<?php echo U('agent/dailishouye',array('status'=>$status));?>&p="+page,function(result){
				$('#morebtn').attr("data",page);//重置当前页数
				var data=result.agentreserve;
				var status=result.status;
				var statustitle=result.statustitle;
				if(data.length>0){
					var html="";
					for(var i=0;i<data.length;i++){
						html+='<ul id="jubu">';
						
						html+="<a href=\"<?php echo U('agent/dailixiangqing',array('reserve_id'=>$data['id']));?>\">";
						
						
						html+='		<li>';
						if(status==5){
						html+='			<p>'+data[i].open_time1+'<span>'+data[i].open_time2+'</span></p>';

						}else{

						html+='			<p>'+data[i].time1+'<span>'+data[i].time2+'</span></p>';

						}
						if(data[i].set_title){
						html+='			<p class="p01">'+data[i].uname+'</p><p class="p02">'+
						data[i].set_title+'</p><p class="p03">'+data[i].name+'</p><p class="p04">'+statustitle+'</p>';
						}else{
						html+='			<p class="p01">'+data[i].uname+'</p><p class="p02"></p><p class="p03">'+data[i].name+'</p><p class="p04">'+statustitle+'</p>';
						}
						html+='		</li>';
						html+='		</a>';
						html+='</ul>';
					}
					$(".list").append(html);
				}else{
					$("#morebtn").html('亲，没有数据了！');
				}
			});
		}
		</script>
	</body>
</html>